package com.hm.three;

import java.io.FileOutputStream;
import java.io.IOException;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

@Configuration
@ImportResource(locations="classpath:work.cfg.xml")
public class Main {
	
	public static void main(String[] args) throws IOException {
		@SuppressWarnings( "resource" )
		ApplicationContext ac=new AnnotationConfigApplicationContext(Main.class);

		Student ming = (Student) ac.getBean("xiaoming");
		System.out.println(ming);
		
		Student fang = (Student) ac.getBean("xiaofang");
		System.out.println(fang);
		
		System.out.println("--------------------------------------");
		
		 FileOutputStream add=(FileOutputStream)ac.getBean("add");
        
        String str = "today is goodday\r\n" + 
        		"the cloud is not found\r\n" + 
        		"the air is soo cold\r\n" + 
        		"my foot quik missing" ;        
        byte b[] = str.getBytes() ;            
        add.write(b) ;                        
        add.close() ;                        
    }
	}
